import request from '@/utils/request'
import Qs from 'qs'

// 查询所有权限   树形结构
export function treeFindAll(params) {
  return request({
    url: '/admin/permission/findAll',
    method: 'get',
    params: params,
  })
}

// 查询当前角色所有权限(只到菜单级)
export function findCurrent(params) {
  return request({
    url: '/admin/permission/findCurrent',
    method: 'get',
    params: params,
  })
}

// 新增权限接口
export function permissionAdd(params) {
  return request({
    url: '/admin/permission/add',
    method: 'POST',
    data: params,
  })
}

// 删除权限接口
export function deleteMenu(params) {
  return request({
    url: '/admin/permission/delete',
    method: 'POST',
    data: params,
  })
}

// 修改权限接口
export function updateMenu(params) {
  return request({
    url: '/admin/permission/update',
    method: 'POST',
    data: params,
  })
}

// 查询权限接口详情
export function detailMenu(params) {
  return request({
    url: '/admin/permission/findDetail',
    method: 'get',
    params: params,
  })
}

// 查询用户所有角色 GET
export function findUserAll(params) {
  return request({
    url: '/admin/user/findAll',
    method: 'get',
    params: params,
  })
}

// GET GET
export function findUserList(params) {
  return request({
    url: '/admin/user/findList',
    method: 'get',
    params: params,
  })
}

// POST 新增用户接口

export function addUserInfo(params) {
  return request({
    url: '/admin/user/add',
    method: 'POST',
    data: params,
  })
}

// 删除用户接口
export function deleteUser(params) {
  return request({
    url: '/admin/user/delete',
    method: 'POST',
    data: params,
  })
}
// POST 修改用户接口
export function updateUser(params) {
  return request({
    url: '/admin/user/update',
    method: 'POST',
    data: params,
  })
}

// GET 为用户赋值角色
export function assignUser(params) {
  return request({
    url: '/admin/user/assign',
    method: 'post',
    data: params,
  })
}
// GET 查询所有角色
export function getRoleList(params) {
  return request({
    url: '/admin/role/findAll',
    method: 'get',
    params: params,
  })
}

export function updatePassword(params) {
  return request({
    url: '/admin/user/updatePassword',
    method: 'post',
    data: params,
  })
}

// 重置密码
export function resetUser(params) {
  return request({
    url: '/admin/user/reloadPassword',
    method: 'post',
    data: params,
  })
}
